/**
 * Bestpay.com.cn Inc.
 * Copyright (c) 2011-2020 All Rights Reserved.
 */
package com.suxiaoxiao.springbootlearn.designpattern.statepattern.goodcode.rmi.client;

import com.suxiaoxiao.springbootlearn.designpattern.statepattern.goodcode.rmi.server.GumballMachineRemote;

import java.net.MalformedURLException;
import java.rmi.Naming;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;

/**
 * desc
 *
 * @author zhaorongzhang
 * @version GumballMonitorTestDrive.java, v 0.1 2020/1/11 11:04 下午 zhaorongzhang Exp $$
 */
public class GumballMonitorTestDrive {

    public static void main(String[] args) {
        String location = "gumballMachine";
        GumballMonitor gumballMonitor = null;
        try {
            GumballMachineRemote machine = (GumballMachineRemote) Naming.lookup(location);
            gumballMonitor = new GumballMonitor(machine);
        } catch (NotBoundException e) {
            e.printStackTrace();
        } catch (MalformedURLException e) {
            e.printStackTrace();
        } catch (RemoteException e) {
            e.printStackTrace();
        }

        assert gumballMonitor != null;
        gumballMonitor.report();

    }

}